#pragma once

#include "Math/Rect.h"
#include "TextArrangeParameters.m.h"

class RFont;

RENUM(ExportMacro="WHENGINE_API")
enum class ETextWrapMethod
{
    None=0,
    WrapByWidth=0x01, //Wrap by width only works when Widget width is set or calculated 
    WrapAtLineEnd=0x10,
    WrapByWidthAndAtLineEnd=0x11,
};

RENUM(ExportMacro="WHENGINE_API")
enum class ETextHorizontalAlignment
{
    Left,
    Center,
    Right,
    Scatter,
};

RENUM(ExportMacro="WHENGINE_API")
enum class ETextVerticalAlignment
{
    Top,
    Center,
    Bottom,
};


struct STextArrangePapameters
{
    TSharedObjectPtr<RFont> Font;
    uint32_t FontSize=0;    

    CString Text;
    ETextWrapMethod Wrap=ETextWrapMethod::None;

    ETextHorizontalAlignment HorizontalAlign=ETextHorizontalAlignment::Left;
    ETextVerticalAlignment VerticalAlign=ETextVerticalAlignment::Top; 

    //the area that can render text, generally is  text widget rect
    SVec2 PaintAreaSize;
    
    bool operator==(const STextArrangePapameters& Other)const
    {
        return Font==Other.Font
            &&FontSize==Other.FontSize
            &&Text==Other.Text
            &&Wrap==Other.Wrap
            &&HorizontalAlign==Other.HorizontalAlign
            &&VerticalAlign==Other.VerticalAlign
            &&PaintAreaSize==Other.PaintAreaSize;
    }
};